package pa2.node;

import java.rmi.RemoteException;
import java.util.Map;

import pa2.system.Peer;
import pa2.system.PeerImpl;
import pa2.util.EqualityCompare;

public class LocalNodeFactory extends NodeFactoryDecorator {
	
	private PeerImpl peer;

	public LocalNodeFactory(NodeFactory decoratedNodeFactory, PeerImpl peer) {
		super(decoratedNodeFactory);
		this.peer = peer;
	}

	@Override
	public <K extends EqualityCompare<K>, V, M extends Map<K, V>> Node<K, V, M> createNode(
			K key, NodeData<K, V, M> data) throws RemoteException {
		return new LocalNode<K,V,M>(super.createNode(key, data),this.peer);
	}

	@Override
	public <K extends EqualityCompare<K>, V, M extends Map<K, V>> void destroyNode(
			Node<K, V, M> node) throws RemoteException {
		//TODO destroy LocalNode
		super.destroyNode(node);
	}
	
	

}
